package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 借款人类型
 * @author: liaozuliang
 * @date: 2018/4/25
 */
@Getter
@AllArgsConstructor
public enum BorrowerTypeEnum {

    PERSONAL((byte) 1, "个人"),
    COMPANY((byte) 2, "企业");

    private Byte type;
    private String desc;

    public static BorrowerTypeEnum typeOf(Byte type) {
        for (BorrowerTypeEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        throw new NoSuchEnumValueException("未找到对应枚举，type=" + type);
    }
}
